var p = null;
var a = null;
var b = null;
var m = null;

$(document).ready(function(){
	

	a = new api(1);
	b = new brain(a);
	m = new map(a);
	p = new player(a,b,m);
	a.update();
	m.update();
	
	setInterval ( "p.update()", 3000 )
});

function player(api,brain,map)
{
	//properties
	this.api = api;
	this.brain = brain;
	this.turn = 0;
	this.map = map;
	
	//functions
	this.update = function update()
	{
		if(this.api.getturn() > this.turn)
		{
			console.log('turns');
			this.api.update();
			this.map.update();
			this.brain.think();
			this.api.submit();
			this.turn = this.api.turn;
		}
	};
}








